import request from '@/utils/request'
/**
 * 菜单相关API
 */
// 添加菜单
export const addMenu = data => {
  return request({
    method: 'POST',
    url: '/admin/menu/add_menu',
    data,
    auth: 'AddMenu'
  })
}
// 编辑菜单
export const editMenu = data => {
  return request({
    method: 'POST',
    url: '/admin/menu/edit_menu',
    data,
    auth: 'EditMenu'
  })
}
// 修改菜单状态
export const statusMenu = data => {
  return request({
    method: 'POST',
    url: '/admin/menu/status_menu',
    data,
    auth: 'DelMenu'
  })
}
// 获取菜单列表(包括按钮)
export const getAllMenus = () => {
  return request({
    method: 'GET',
    url: '/admin/menu/get_all_menus',
    auth: 'Menu'
  })
}
// 获取菜单列表
export const getMenus = () => {
  return request({
    method: 'GET',
    url: '/admin/menu/get_menus',
    auth: 'Menu'
  })
}
// 获取角色获取菜单列表(不包括按钮)
export const getMenusByRole = () => {
  return request({
    method: 'GET',
    url: '/admin/menu/get_menus_by_role'
  })
}
// 获取所有前端路由
export const getVueRoutes = () => {
  return request({
    method: 'GET',
    url: '/admin/menu/get_vue_routes',
    auth: 'Menu'
  })
}
// 获取角色前端路由
export const getVueRoutesByRole = data => {
  return request({
    method: 'GET',
    url: '/admin/menu/get_vue_routes_by_role',
    data
  })
}
